<?php

class Session
{
  public function start($redirect)
  {
    session_start();
    header("Location: " . __ROOT_URL . $redirect);
  }
  
  public function set($param, $value)
  {
    if(!$param || !$value) 
    {
      return false; 
    }
    $_SESSION[$param] = $value; 
  }
  
  public function get($param)
  {
    if ($param) return $_SESSION[$param]; 
  }
  
  public function del($params)
  {
    if(!is_array($params)) 
    {
      unset($_SESSION[$params]);
    }
    else{
      foreach($params as $element)
      {
        unset($_SESSION[$element]);
      }
    }
    return true;
  }
  
  public function end($redirect)
  {
    $_SESSION = array(); 
    session_destroy();
    header("Location: " . __ROOT_URL . $redirect);
  }
}

?>